import request from "./https";

const api = {
    // 预留的公共接口
}
export default api;

export function get(url, parameter) {
    return request({
        url: url,
        method: 'get',
        params: parameter
    })
};

export function post(url, parameter) {
    return request({
        url: url,
        method: "post",
        params: parameter
    })
};

// post method= {post | put | get| delete}
export function httpAction(url, parameter, method, contentType) {
    debugger
    return request({
        url: url,
        method: method,
        data: parameter,
        header: {
            //常用 "application/json" "application/x-www-form-urlencoded"
            "Content-Type": contentType

        }
    })
};

//put
export function putAction(url, parameter) {
    return request({
        url: url,
        method: 'put',
        data: parameter
    })
};

//deleteAction
export function deleteAction(url, parameter) {
    return request({
        url: url,
        method: 'delete',
        params: parameter
    })
}

// 获取pdf二进制文件流
export function postPdf(url, data) {
    return request({
        url: url,
        method: 'post',
        data: data,
        header: {
            //常用 "application/json" "application/x-www-form-urlencoded"
            "Content-Type": 'application/json;charset=utf-8'
        },
        responseType: 'blob' //arraybuffer/blob//加上格式，二进制
    })
}

